<template>
    <el-form label-width="120px" >

        <el-form-item label="开启拼单" >
            <!-- <el-switch v-model="product.status" /> -->
            <el-switch v-model="product_pindan.status" active-value="1" inactive-value="0" />
        </el-form-item>
        <el-form-item label="拼单价格" >
            <el-input v-model="product_pindan.price" placeholder="销售价格">
                <template #append>￥</template>
            </el-input>
        </el-form-item>
        <el-form-item label="有效时间" >
            <el-input-number v-model="product_pindan.validate_time" :min="0"  @change="" />
        </el-form-item>
    </el-form>

</template>

<script lang="ts" setup>


import { ref, inject,watch } from 'vue';

// const product_pindan = inject( 'product_pindan' )
const product:any = inject( 'product' )
const product_pindan:any = ref({
    goods_id: 0,
    id: 0,
    number: 0,
    price: "0.00",
    status: 0,
    // uniacid: 8,
    validate_time: 0
});

    watch( product, (newVal:any, oldVal:any )=>{
        console.log('product pindan:',newVal,oldVal)
        if( newVal.pindan ){
            newVal.pindan.status += '' ;
            product_pindan.value = newVal.pindan;
        }
    },
    {
        immediate:true
    })
</script>